#!/bin/bash

# Copyright 2018 Jan Pazdziora
#
# Licensed under the Apache License, Version 2.0 (the "License").

# Set up Ipsilon server (SAML IdP). It can be used on FreeIPA host
# (container) as well.

set -e

exec >> /run/docker-console/fd/1 2>> /run/docker-console/fd/2

echo "Waiting for SP ..."
while ! echo "select value from saml2_data where name = 'id'" | sqlite3 /var/lib/ipsilon/idp/adminconfig.sqlite | grep . ; do
	sleep 5
done
sleep 5
echo "SP found configured."
